# -*- coding: utf-8 -*-
import os
import subprocess

# files = os.popen("cmd")
# todo：方式1
# os.system('ipconfig')
# todo:方式2
# p = os.popen('ipconfig')
# print("p.read(): {}\n".format(p.read()))

# todo：方式3

dirpath=[r'E:\devcode\kzsny\wmp\wmp-uca-web-main',r'E:\devcode\kzsny\wmp\wmp-uca-web-ssoLogin',r'E:\devcode\kzsny\wmp\wmp-uca-web-usm',r'E:\devcode\kzsny\wmp\wmp-uca-web-login',
         r'E:\devcode\kzsny\wmp\NewEnergy-web',r'E:\devcode\kzsny\wmp\NewEnergy-web-business',r'E:\devcode\kzsny\wmp\NewEnergy-web-usm']


for it in dirpath:
    # p1 = subprocess.Popen('npm run start', shell=True, cwd=it, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
    # p1 = subprocess.Popen('npm run start', shell=True, cwd=it, creationflags=subprocess.CREATE_NEW_CONSOLE)
    # p1 = subprocess.Popen('npm run start',  cwd=it,creationflags=subprocess.CREATE_NEW_CONSOLE)
    p1 = subprocess.Popen('npm run start',  shell=True, cwd=it)

# p = subprocess.Popen('ls -l', shell=True)
# p1 = subprocess.Popen('npm run start', shell=True,cwd=r'E:\devcode\kzsny\wmp\wmp-uca-web-main')
# p2= subprocess.Popen('npm run start', shell=True,cwd=r'E:\devcode\kzsny\wmp\wmp-uca-web-ssoLogin')
# p3 = subprocess.Popen('npm run start', shell=True,cwd=r'E:\devcode\kzsny\wmp\wmp-uca-web-usm')
# p4= subprocess.Popen('npm run start', shell=True,cwd=r'E:\devcode\kzsny\wmp\wmp-uca-web-login')
#
# p5 = subprocess.Popen('npm run start', shell=True,cwd=r'E:\devcode\kzsny\wmp\NewEnergy-web')
# p6= subprocess.Popen('npm run start', shell=True,cwd=r'E:\devcode\kzsny\wmp\NewEnergy-web-business')
# p7 = subprocess.Popen('npm run start', shell=True,cwd=r'E:\devcode\kzsny\wmp\NewEnergy-web-usm')

# p.returncode
# p.wait()  # 0
# p.pid  # 子进程的 PID
# p.returncode  # 子进程的返回状态.
# #  None —— 子进程尚未结束；
# #  ==0 —— 子进程正常退出；
# #  > 0—— 子进程异常退出，returncode对应于出错码；
# #  < 0—— 子进程被信号杀掉了.
# p.stdin
# p.stdout
# p.stderr